package com.tedu.egweibo1.result;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class JsonResult {
    private Integer state;
    private String message;
    private Object data;

    public JsonResult(StatusCode status) {
        this.state = status.getStatuscode();
        this.message = status.getMsg();
    }

    public JsonResult(StatusCode status,Object data) {
        this(status);
        this.data = data;
    }

    public static JsonResult success(Object data){

        return new JsonResult(StatusCode.OPERATION_SUCCESS,data);
    }
    public static JsonResult success(){
        return success(null);
    }

}
